Skip to content

Add a swappable table rendering seam (TableRenderer + bindQuery) - #108

Open
woksin wants to merge 4 commits into
feat/primereact-11-migrationfrom
feat/table-rendering-seam
Open

Add a swappable table rendering seam (TableRenderer + bindQuery)#108
woksin wants to merge 4 commits into
feat/primereact-11-migrationfrom
feat/table-rendering-seam

Conversation

@woksin

@woksin woksin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Formalizes the table rendering seam: a small, UI-library-agnostic contract that lets Cratis's query and paging behavior drive any table rendering. The split already existed unnamed — DataTableCore was a pure renderer and the two query tables were paging behavior wrapped around it — so this names the contract and re-expresses the tables on top of it with no change to their public API.

Added

  • TableRenderer<TData> and TableRendererProps<TData> — a curated, PrimeReact-free contract describing what a table renderer is handed (one page of rows, selection, paging-agnostic props). Exported from @cratis/components/DataTables.
  • bindQuery and bindObservableQuery — higher-order helpers that pair Cratis's query + paging behavior (and the paginator) with any TableRenderer, so consumers can render a query's paged rows with their own table implementation and keep Cratis's data behavior for free.
  • DataTableCore is now exported from @cratis/components/DataTables as the default TableRenderer implementation.
  • Documentation page "Bring your own table renderer" describing the seam and how to bind a custom renderer.

Changed

  • DataTableForQuery and DataTableForObservableQuery are now built on the rendering seam (bindQuery(DataTableCore) / bindObservableQuery(DataTableCore)). Their public props — including the PrimeReact pt / ptOptions / unstyled pass-through — and runtime behavior are unchanged.

🤖 Generated with Claude Code

woksin and others added 4 commits July 17, 2026 12:45
Introduce TableRenderer<TData> and TableRendererProps<TData> — a small,
UI-library-agnostic contract describing what a table renderer is handed
(one page of rows, selection, paging-agnostic props). Move the row-click
event into its own file so the contract can reference it, and re-express
DataTableCoreProps as `extends TableRendererProps` plus the PrimeReact
pass-through and rendering extras. DataTableCore is unchanged at runtime;
it is now the default implementation of the seam.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add bindQuery and bindObservableQuery — higher-order helpers that pair
Cratis's query + paging behavior (and the paginator) with any
TableRenderer, mirroring the asCommandFormField adapter pattern. The
renderer receives only the UI-library-agnostic TableRendererProps; the
query never leaks across the seam.

Re-express DataTableForQuery as bindQuery(DataTableCore) and
DataTableForObservableQuery as bindObservableQuery(DataTableCore). Public
props (including the PrimeReact pt/ptOptions/unstyled pass-through) and
runtime behavior are unchanged — the PrimeReact-specific props are layered
on at the table wrapper, not in the seam. Export the new surface and
DataTableCore from the DataTables barrel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a BDD spec that binds a trivial, non-DataTableCore renderer (a plain
list) via bindQuery and asserts a consumer gets Cratis's paged query data
and paginator with their own rendering. Add a Storybook story that binds a
card-list renderer to a paged query for the visual counterpart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a DataTables docs page explaining the rendering seam and how to bind a
custom TableRenderer with bindQuery/bindObservableQuery, wired into the
section toc and linked from the overview.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@woksin

woksin commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up / eventual home: the bindQuery / bindObservableQuery behavior (and the TableRenderer contract) is kept in @cratis/components for this proof, but its natural long-term home is @cratis/arc.react — beside useQueryWithPaging and the asCommandFormField sibling — so the query/paging binding is usable without a PrimeReact dependency. The blocker is that bindQuery currently also renders the PrimeReact paginator, so the rendering must be split out of the behavior first. Tracked in #109 (cross-repo). No change intended for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant